<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta content="user-scalable=no,width=device-width, initial-scale=1" id="viewport" name="viewport" initial-scale="1">

		<script language="javascript" type="text/javascript" src="../js/js/baseJs.js"></script>

	</head>
	<body>

		<div class="wap-upload-requirements" id="bankList" style="display: none;">
			<div class="wap-header">实名认证
				<a class="back" onClick="javascript:window.history.back();return false;"></a>
			</div>
			<div class="require-c-bd" style="margin-top: 1rem;">
				<div class="l-input-group">
					
					<div class="title-c">
						<div class="title">开户行：</div><input placeholder="输入开户行" v-model="openingBank">
					</div>
					<div class="title-c">
						<div class="title">银行卡号：</div><input placeholder="输入银行卡号" v-model="bankNo">
					</div>
					<div class="title-c">
						<div class="title">姓名：</div><input placeholder="输入真实姓名" v-model="realName">
					</div>
					<div class="title-c">
						<div class="title">银行名称：</div><input placeholder="输入银行名称" v-model="selectedBank">
					</div>
				</div>
			</div>
			<!-- <div style="display: flex;flex-direction: row;font-size: .2rem;align-items: center;">
				<div style="padding-left: .7rem;margin: .4rem 0;font-size: .26rem;">选择银行：</div>
				<select v-model="selectedBank" style="width: 2rem;height: .56rem;">
				  <option v-for="option in options" v-bind:value="option.text" >
				    {{ option.text }}
				  </option>
				</select>
	
			</div> -->
			<div class="wap-comfirm-button" @click="confimUpload()">确定</div>
		</div>
		<script src="../js/js/rem_fix.js"></script>
		<script src="../js/js/common.js"></script>
		<script type="text/javascript">
			var token = getCookie("userToken");
			var userId = getCookie("userId");
			var projectId = parseInt(window.location.hash.split("#")[1]);
			var loginUrl = "../userBundle/login.mobile.html" + "?" + "../userBundle/bankIdentification.mobile.html";
			if (!token || !userId) {
				window.location.href = loginUrl;
			}
			var bankListApp = new Vue({
				el: '#bankList',
				data: {
					bankNo: '',
					realName: '',
					openingBank: '',
					isDoing: false,
					selectedBank: '',
					options: [
					  { text: '工商银行' },
					  { text: '宁波银行'},
					  { text: '中国银行'},
					  { text: '建设银行'},
					  { text: '绍兴银行'},
					  { text: '农业银行'}
					]
				},
				ready: function() {
					$("#bankList").show();
				},
				methods: {
					confimUpload: function() {
						if (this.isDoing) {
							return
						}
						if (!this.bankNo) {
							alert("请填写银行卡号")
							return
						}
						if (!this.openingBank) {
							alert("请填写开户行")
							return
						}
						if (!this.realName) {
							alert("请填写真实姓名")
							return
						}
						this.isDoing = true;
						var url = "/user/addAccount";
						var data = {
							aliPayInfo: {
								account: "",
								accountName: ""
							},
							bankInfo: {
								account: this.bankNo,
								accountAddress: this.openingBank,
								accountName: this.realName,
								accountType: this.selectedBank
							},
							client: 1,
							token: token,
							userId: parseInt(userId)
						}
						pushData(url, data, function(res) {
							this.isDoing = false;
							if (res.state) {
								alert("实名成功")
								window.location.href="./tradingCenter.mobile.html"
							} else if (res.errorCode == 008) {
								window.location.href = loginUrl;
							} else {
								alert(res.message)
							}
						}.bind(this))
					},
					
				}
			})
			
		</script>

	</body>
</html>
